package database;

import javax.swing.*;
import java.awt.*;
import java.awt.event.ActionEvent;
import java.awt.event.ActionListener;

public class Window extends JFrame {

    public Window(){
        JFrame f = new JFrame("寝室管理系统");
        f.setLayout(new GridLayout(2,2));
        f.setSize(400,400);
        f.setLocation(450,200);
        ImageIcon imgjb1 = new ImageIcon("image/create.png");

        JButton jb1 = new JButton();
        jb1.setIcon(imgjb1);
        jb1.setRolloverIcon(imgjb1);
        f.add(jb1);
        JButton jb2 = new JButton();
        jb2.setIcon(new ImageIcon("image/delete.png"));
        f.add(jb2);
        JButton jb3 = new JButton();
        jb3.setIcon(new ImageIcon("image/update.png"));
        f.add(jb3);
        JButton jb4 = new JButton();
        jb4.setIcon(new ImageIcon("image/search.png"));
        f.add(jb4);
        jb1.addActionListener(new ActionListener() {
            @Override
            public void actionPerformed(ActionEvent e) {
                new HelpSelect(1);
            }
        });
        jb2.addActionListener(new ActionListener() {
            @Override
            public void actionPerformed(ActionEvent e) {
                new HelpSelect(2);
            }
        });
        jb3.addActionListener(new ActionListener() {
            @Override
            public void actionPerformed(ActionEvent e) {
                new HelpSelect(3);
            }
        });
        jb4.addActionListener(new ActionListener() {
            @Override
            public void actionPerformed(ActionEvent e) {
                new HelpSelect(4);
            }
        });
        f.setVisible(true);
        f.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
    }

}
